package com.lfg.leetcode.leetcode300;


public class No343integerBreak {
    public static void main(String[] args) {
        System.out.println(integerBreak(2));
    }

    public static int integerBreak(int n) {
        int[] dp = new int[n + 1];// 到达i的最大成绩之和
        dp[1] = 1;
        for (int i = 2; i <= n; i++) {
            for (int j = 1; j < i; j++) {
                dp[i] = Math.max(dp[i], dp[i - j] * j);
                dp[i] = Math.max(dp[i], (i - j) * j);
            }
        }
        return dp[n];
    }

}



